package com.woniu.microprojectserver.spaceclassmag.service.impl;

import com.woniu.microcommonsserver.entity.BuildClassInfoEntity;
import com.woniu.microcommonsserver.entity.SpaceClassInfoEntity;
import com.woniu.microprojectserver.buildclassmag.mapper.BuildClassMapper;
import com.woniu.microprojectserver.spaceclassmag.mapper.SpaceClassMapper;
import com.woniu.microprojectserver.spaceclassmag.service.ISpaceClassService;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ：pengchufeng
 * @date ：Created in 2021/1/30
 * @description：空间类型service接口实现
 */
@Transactional(readOnly = true)
@Service
public class SpaceClassServiceImpl implements ISpaceClassService {

    @Resource
    private SpaceClassMapper spaceClassMapper;

    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    public List<SpaceClassInfoEntity> findAll() {
        return spaceClassMapper.findAll();
    }

    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    public List<SpaceClassInfoEntity> findByName(@Param("name")String name) {
        return spaceClassMapper.findByName(name);
    }

    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    public SpaceClassInfoEntity findById(String id) {
        return spaceClassMapper.findById(id);
    }

    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    public boolean add(SpaceClassInfoEntity spaceClassInfoEntity) {
        spaceClassMapper.add(spaceClassInfoEntity);
        return true;
    }

    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    public boolean update(SpaceClassInfoEntity spaceClassInfoEntity) {
        spaceClassMapper.update(spaceClassInfoEntity);
        return true;
    }


}
